package com.cl.cloud.binlog.listener;

import com.github.shyiko.mysql.binlog.BinaryLogClient;
import lombok.extern.slf4j.Slf4j;

/**
 * @description: binlog生命周期监听器
 * @author: liuzijian
 * @time: 2022-07-08 18:02
 */
@Slf4j
public class BinlogLifecycleListener implements BinaryLogClient.LifecycleListener {
    @Override
    public void onConnect(BinaryLogClient client) {
        log.info("binlong客户端开始连接");
    }

    @Override
    public void onCommunicationFailure(BinaryLogClient client, Exception ex) {
        log.error("binlong客户端监听链接错误", ex);
    }

    @Override
    public void onEventDeserializationFailure(BinaryLogClient client, Exception ex) {
        log.error("binlong客户端监听事件错误", ex);
    }

    @Override
    public void onDisconnect(BinaryLogClient client) {
        log.info("binlong客户端关闭连接");
    }
}
